<extend name="Public/base"/>

<block name="body">
    <div class="main-title">
        <h2><present name="data">[ {$data.title} ] 子</present>{$meta_title} </h2>
    </div>

    <div class="cf">
        <a class="btn " href="{:U('Rose/addNextPeriod')}">开始下一期</a>
        <button class="btn ajax-post" target-form="ids" url="{:U('Rose/del')}">删除</button>
        <!--<button class="btn download search"  url="{:U('Money/download')}" >导出</button>-->
        <!-- 高级搜索 -->
        <div class="search-form fr cf">

            <div class="sleft">
                <input type="text" name="periods" class="search-input" value="{:I('periods')}" placeholder="请输入期数">
                <!--<div class="btn-group-click adv-sch-pannel fl">-->
                    <!--<button class="btn">高 级<i class="btn-arrowdown"></i></button>-->
                    <!--<div class="dropdown cf">-->
                        <!--<div class="row">-->
                            <!--<label>活动时间：</label>-->
                            <!--<input type="text" id="time-start" name="time" class="text input-2x" value="{:I('time')}" placeholder="活动名" />-->
                        <!--</div>-->
                    <!--</div>-->
                <!--</div>-->
                <a class="sch-btn search" href="javascript:;" id="search" url="{:U('index')}"><i class="btn-search"></i></a>
            </div>

        </div>
    </div>
    <div class="data-table table-striped">
        <form class="ids">
            <table>
                <thead>
                    <tr>
                        <th class="row-selected">
                            <input class="checkbox check-all" type="checkbox">
                        </th>
                        <th>ID</th>
                        <th>期数</th>
                        <th>活动开始时间</th>
                        <th>活动结束时间</th>
                        <th>活动状态</th>
                        <th>是否生成了获奖名单</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
				<notempty name="list">
                <volist name="list" id="vo">
                    <tr>
                        <td><input class="ids row-selected" type="checkbox" name="id[]" value="{$vo.id}"></td>
                        <td>{$vo.id}</td>
                        <!--<td>{$vo.time}</td>-->
                        <td>第{$vo.periods}期</td>
                        <!--<td>{$vo.periods_start_time}</td>-->
                        <!--<td>{$vo.periods_end_time}</td>-->
                        <td>{$vo.periods_start_time|date="Y-m-d H:i:s",###}</td>
                        <td>{$vo.periods_end_time|date="Y-m-d H:i:s",###}</td>
                        <td> <if condition="$vo['status'] eq 1">进行中<else/>已结束</if></td>
                        <td> <if condition="$vo['is_prized'] eq 1">是<else/>否</if></td>
                        <td>
                            <a class="" title="编辑" href="{:U('editNextPeriod?id='.$vo['id'])}">编辑</a>
                            <a class="confirm ajax-get" title="删除" href="{:U('del?id='.$vo['id'])}">删除</a>
                            <a class="confirm"  href="{:U('Bet/index',array('periods'=>$vo['periods']))}">查看下注列表</a>
                            <a class="confirm"  href="{:U('Prize/add',array('periods'=>$vo['periods']))}">设置奖项</a>
                            <a class="confirm"  href="{:U('Rose/ranking_list',array('periods'=>$vo['periods']))}">查看排名</a>
                            <eq name="vo.is_prized" value="1">
                                <a class="confirm"  href="{:U('Rose/win_list',array('periods'=>$vo['periods']))}">查看中奖名单</a>
                             </eq>
                        </td>
                    </tr>
                </volist>
				<else/>
				<td colspan="10" class="text-center"> aOh! 暂时还没有内容! </td>
				</notempty>
                </tbody>
            </table>
        </form>
        <!-- 分页 -->
        <div class="page">
            {$_page}
        </div>
    </div>
</block>

<block name="script">
    <link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
    <php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php>
    <link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
    <script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
    <script type="text/javascript">
        $(function() {
            //搜索功能
            $(".search").click(function() {
                var url = $(this).attr('url');
                var query = $('.search-form').find('input').serialize();
               // var type = $(".sort-txt").eq(0).attr("data");
               // query=query+'&'+'type='+type;
                query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
                query = query.replace(/^&/g, '');
                if (url.indexOf('?') > 0) {
                    url += '&' + query;
                } else {
                    url += '?' + query;
                }
               // alert(url);exit;
                window.location.href = url;
            });
            //回车搜索
            $(".search-input").keyup(function(e) {
                if (e.keyCode === 13) {
                    $("#search").click();
                    return false;
                }
            });
            //导航高亮
           // highlight_subnav("{:U('index')}");
            $("#sort").click(function(){
                var obj=$(".sort");
                var arr='';
                var idstring='';
                for(i=0;i<obj.length;i++){
                    arr+=obj.eq(i).val()+',';
                    idstring+=obj.eq(i).attr('date')+',';
                }
                arr= arr.substr(0,arr.length-1);
                idstring= idstring.substr(0,idstring.length-1);
                var url="{:U('Product/sort')}/sort/"+arr+'/id/'+idstring;
                $(this).attr('url',url);
            })

            /* 状态搜索子菜单 */
            $(".search-form").find(".drop-down").hover(function(){
                $(this).find(".sub-sch-menu").removeClass("hidden");
            },function(){
                $(this).find(".sub-sch-menu").addClass("hidden");
            });
            $(".sub-sch-menu li").find("a").each(function(){
                var obj=$(this);
                $(this).click(function(){
                    var text = $(this).text();
                    obj.parent().parent().parent().find('.sort-txt').text(text).attr("data",$(this).attr("value"));;
                    obj.parent().parent().parent().find('.sub_sch-menu').addClass("hidden");
                })
            });

            $('#time-start').datetimepicker({
                format: 'yyyymmdd',
                language:"zh-CN",
                minView:2,
                autoclose:true
            });

            $('#datetimepicker').datetimepicker({
                format: 'yyyymmdd',
                language:"zh-CN",
                minView:2,
                autoclose:true,
                pickerPosition:'bottom-left'
            })
        });
    </script>
</block>